package com.xqiapp;

import com.xqiapp.entity.User;
import com.xqiapp.service.LoginService;
import com.xqiapp.bean.Page;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ImportResource;

import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;

@SpringBootApplication
@ImportResource({"classpath:dubbo-client.xml"})
public class WebxApiClientApplication {

	public static void main(String[] args) {

		ApplicationContext ctx = SpringApplication.run(WebxApiClientApplication.class, args);
		LoginService loginService = (LoginService) ctx.getBean("loginService");
		User user =loginService.login("12123", "23234234");
		System.out.println(user.toString());

		Page page = loginService.findPageByDescription("根据");

		int pageSize = page.getPageCount();
		long totol = page.getTotal();

		System.out.println(pageSize+"   "+totol);

		Collection list = page.getRows();

		Iterator iterator = list.iterator();
		while (iterator.hasNext()){
			Map map = (Map) iterator.next();
			System.out.println(map.toString());
		}

		user = new User(UUID.randomUUID().toString(),"show","show");

		int count = loginService.addUser(user);

		System.out.println("----------------count:"+count);

	}
}
